home *** CD-ROM | disk | FTP | other *** search
/ Loadstar 248 / 248.d81 / t.db+ doc 3 < prev    next >
Text File  |  2022-08-26  |  14KB  |  542 lines

  1. u
  2.             DOTBASIC PLUS
  3.                Part III
  4.      by Dave Moorman & Lee Novak
  5.  
  6.  
  7.     Never again must you fight for
  8. string space in your text adventures
  9. and other programs. With the following
  10. commands, you can put your lines of
  11. text in a Edstar file (Edstar is our
  12. nifty text editor that produces 38-
  13. column lines of text), use .BL0 to
  14. bload it into memory (under ROM), the
  15. use RACK (.RK) to turn the text into a
  16. virtual string array. RACK INDEX (.RI)
  17. will put any line into W$ for use in
  18. your program. Here is a simple
  19. example:
  20.  
  21.  100 .BL0,"T.DISKOVER",D,40960
  22.  110 .RK,40960
  23.  120 FOR X = 1 TO N%
  24.  130 .RI,X
  25.  140 PRINT W$
  26.  150 NEXT
  27.  
  28.  
  29.   RACK EDSTAR FILE
  30.   ----------------
  31.     Include: .RK
  32.   .RK,LOCATION
  33.  
  34.     This routine takes an EDSTAR file
  35. (terminated by a zero) and "racks it
  36. up". A table of pointers is created
  37. right after the zero at the end of the
  38. text, enabling you to use .RI or .PRI
  39. to grab or print individual lines of
  40. the file.
  41.  
  42.     The file can be located anywhere
  43. in memory, even under I/O. Racking
  44. needs 3 bytes per line at the end of
  45. the file for its pointers. The total
  46. number of items is returned in N%.
  47.  
  48.  
  49.   INDEX ITEM
  50.   ----------
  51.     Include: .RI
  52.   .RI,INDEX#
  53.  
  54.     Once you've racked up an EDSTAR
  55. file, you can index it. The indexed
  56. item is returned in W$. F$ is also set
  57. by indexing, and will always return a
  58. null unless you happen to be looking
  59. at a directory, in which case it
  60. contains the entry's filename.
  61.  
  62.  
  63.   PRINT ITEM
  64.   ----------
  65.     Include: .PRI
  66.   .PRI,X,Y,INDEX#
  67.  
  68.     This routine indexes an item and
  69. prints it anywhere on the screen. The
  70. string is NOT returned in W$ or F$.
  71.  
  72.  
  73.   PRINT FILENAME
  74.   ----------
  75.     Include: .PRFILE
  76.   .PRFILE,X,Y,INDEX#
  77.  
  78.     If you've used GET DIRECTORY and
  79. have racked up the resulting text, you
  80. can immediately print the filenames.
  81.  
  82.  
  83.   DEFINE REGION TEXT
  84.   ------------------
  85.     Include: .DRTEXT
  86.   .DRTEXT,NUMBER,"STATIC STRING"
  87.  
  88.     The concept of "region text" for
  89. LOADSTAR programs is credited to both
  90. Jeff Jones and myself. CASH FLOWER (LS
  91. #161) and QUICKSMITH (LS #164) both
  92. used the concept, and it's interesting
  93. to note that neither of us knew what
  94. the other was up to.
  95.  
  96.     "Region text" is when the user
  97. moves the mouse pointer around the
  98. screen, and a message bar at the
  99. bottom of the screen informs the user
  100. of what will happen if he or she
  101. clicks on that particular area. These
  102. strings don't have to be associated
  103. with regions - it's just likely that
  104. this will be their most common use.
  105.  
  106.    Related Variables:     (& defaults)
  107.  
  108.   MV+20  Region Text Zone (LB)     (0)
  109.   MV+21  Region Text Zone (HB)     (4)
  110.   MV+22  Region Text Color / Flags (1)
  111.   MV+23  Region Text Row          (24)
  112.  
  113.     Strings defined as region text
  114. must NOT be made by combining smaller
  115. strings. The string's POINTER will be
  116. stored in its proper slot in the
  117. Region Text Zone. Be sure this zone is
  118. safe from BASIC and other data We
  119. suggest the area in pages 46-55. The
  120. Zone will never exceed 3 pages.
  121.  
  122.     All region text will be printed in
  123. MV+22's color. Add 128 to MV+22 for
  124. REVERSE printing. (Adding 64 changes
  125. the way the pointers are stored and is
  126. most useful from ML.)
  127.  
  128.     Add 32 to MV+22 and all your
  129. region text will be CENTERED. Add 16
  130. instead, and each string will be
  131. printed after a forced leading SPACE.
  132.  
  133.  
  134.   EDSTAR TO REGION TEXT
  135.   ---------------------
  136.     Include: .EDRTEXT
  137.   .EDRTEXT,LOCATION
  138.  
  139.     This command defines ALL region
  140. text with a single command! It takes
  141. an EDSTAR file (terminated by 0),
  142. racks it up, and POKEs MV+24 and
  143. MV+25. The number of lines in the file
  144. is returned in N%.
  145.  
  146.     Keep in mind that the FIRST line
  147. of the EDSTAR file will be referenced
  148. by number zero. You can have as many
  149. lines as you want.
  150.  
  151.  
  152.   PRINT REGION TEXT
  153.   -----------------
  154.     Include: .PRTEXT
  155.   .PRTEXT,INDEX
  156.  
  157.     This prints region text on the
  158. line specified in MV+23. It fills up
  159. the unused part of the line with
  160. spaces, so you don't have to worry
  161. about erasing the old text before
  162. printing over it. The string will be
  163. printed as specified in MV+22, above.
  164. Usually the "index" will be RG%, but
  165. it doesn't have to be.
  166.  
  167.     Here is a simple example:
  168.  
  169.  100 .BL0,"TEXTFILE",D,40960
  170.  110 .EDRTEXT,40960
  171.  200 .DO:.MA
  172.  210 .PRTEXT,RG%
  173.  220 .UN CR%
  174.  
  175.  
  176.   PRINT MESSAGE
  177.   -------------
  178.     Include: .MSG
  179.   .MSG,COLOR,STRING
  180.  
  181.     This command prints your string
  182. just like region text. You provide the
  183. color, and MV+22 specifies the reverse
  184. state, centering, or the leading
  185. space. This command is useful for
  186. special prompts and messages. The plus
  187. "+" can be used to concatenate strings
  188. printed by this routine.
  189.  
  190.  
  191.   GET DIRECTORY
  192.   -------------
  193.     Include: .DIR
  194.   .DIR,"$:*",D,LOC,#FILENAMES
  195.  
  196.     This will read the disk directory
  197. from device D. The directory can be
  198. placed anywhere, even under I/O. DB+
  199. converts the directory to an EDSTAR
  200. file as it is brought in. This allows
  201. SCROLLING MENU to use the information
  202. as a file requestor.
  203.  
  204.     Normally you would use "$:*" to
  205. get all the disk's filenames. You can
  206. replace "$:*" with any search pattern
  207. you want, up to 16 characters long.
  208. For example, using "$:b.*,p.*" on a
  209. LOADSTAR disk (using a real C-64 or
  210. True Drive in VICE) would bring in the
  211. names of all the boot and text files.
  212.  
  213.     E$ will return the error message.
  214. T$ will contain the disk's name within
  215. quotes, and B$ will contain the
  216. "blocks free" message. Use VAL(B$) to
  217. extract the number of blocks free on
  218. the disk. N% returns the number of
  219. filenames loaded.
  220.  
  221.     If there was an error during the
  222. directory getting, T$ and B$ will
  223. return strings full of spaces, and E$
  224. will tell about the error. The one
  225. thing your program should do before
  226. disk access is check if the drive is
  227. actually online, like this:
  228.  
  229.    1000 close2:open2,dv,2:close2
  230.    1010 if st=-128 then...
  231.    1020 ...continue
  232.  
  233.     Line 1010 would go and deal with a
  234. "device not present" situation. If all
  235. is well, line 1020 executes and disk
  236. access occurs.
  237.  
  238.     GET DIRECTORY has been greatly
  239. improved with the addition of one more
  240. parameter: how many filenames you have
  241. room to hold. This number should be
  242. calculated as:
  243.  
  244.    # files = INT((bufferspace-1)/32)
  245.  
  246.      For example, if your buffer was
  247. from 49152 to 53248, you could fit
  248. INT((4096-1)/32) = 127 names there.
  249. This formula takes into account the
  250. zero cap and the three bytes per line
  251. that the racking process needs.
  252.  
  253.     If the buffer space is filled up
  254. before all the filenames are loaded,
  255. B$ will return "more files on disk".
  256. If you don't care about buffer space,
  257. use 0 for the number of filenames.
  258.  
  259.     A good place to put your directory
  260. information is in pages 224+. You
  261. easily put 250 filenames in this area
  262. under ROM.
  263.  
  264.  
  265.   SCROLLING MENU
  266.   --------------
  267.     Include: .SCMENU
  268.   .SCMENU,X,Y,W,H,B,I,UN,HI,LOC,T$,B$
  269.  
  270.     For this command to work, you must
  271. have an EDSTAR file in memory, and it
  272. must end with a zero byte OR use .DIR
  273. to get the directory.
  274.  
  275.     The X,Y,W,H parameters set the
  276. area the menu will occupy. H must be
  277. at least 7 characters tall and W 11
  278. wide. B is the color of the menu box.
  279. The unhighlighted items of the menu
  280. are color UN. HI is the highlight bar
  281. color. If you don't want the text to
  282. reverse or un-reverse as the bar
  283. moves, add 128 to HI.
  284.  
  285.     I is the color of the four words
  286. in the corners of the menu: HOME, UP,
  287. DOWN, and QUIT. Left-click on UP or
  288. DOWN to scroll the text. Right-click
  289. on them and the list jumps a page at a
  290. time. The user can use the CRSR keys
  291. to scroll or page through the text as
  292. well.
  293.  
  294.     Clicking on HOME will bring the
  295. list to the top. Pressing the HOME key
  296. will bring the highlight bar to the
  297. top of the page, and the next press
  298. brings the list to the top.
  299.  
  300.     Click on an item or press RETURN
  301. to select it. The entire item is
  302. returned in W$. F$ will return a null
  303. unless this is a file requestor - in
  304. which case it contains the filename.
  305. SL% returns the selection number.
  306.  
  307.     Clicking on QUIT, pressing Q, or
  308. pressing the Global Escape key will
  309. return zero in SL% and nulls in W$ and
  310. F$.
  311.  
  312.     LOC is the location of the EDSTAR
  313. file, which can be anywhere in memory.
  314. The file will be "racked up" before
  315. use, which can take up to a second
  316. (gasp!) on 1 MHz machines. For already
  317. racked data, put 0 in LOC.
  318.  
  319.     T$ is printed at the menu's top,
  320. in r